//
//  SendViewController.m
//  DriftDog
//
//  Created by rimi on 15/9/13.
//  Copyright (c) 2015年 廖马林. All rights reserved.
//

#import "SendViewController.h"

@interface SendViewController ()<UITextViewDelegate>
@property (nonatomic , strong)UILabel *titileLabel;
@property (nonatomic , strong)UIButton *sendButton;
@property (nonatomic , strong)UIButton *addImage;

-(void)initliedUserinterface;
@end

@implementation SendViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initliedUserinterface];
    [self.baseLeftButton addTarget:self action:@selector(buttonwithleft:) forControlEvents:UIControlEventTouchUpInside];
}
-(void)initliedUserinterface{
    self.view.backgroundColor=[UIColor whiteColor];
    /* 添加父类控件 */
    [self addTitleLabelWithName:@"发帖"];
    [self addBaseLeftButtonWithImage:[UIImage imageNamed:@"返回图标"]];
    [self.view addSubview:self.textView];
    [self.view addSubview:self.titileLabel];
    [self.baseNavigationBar addSubview:self.sendButton];
    [self.view addSubview:self.addImage];
}
-(void)buttonwithleft:(UIButton*)sender{
    
    [self.navigationController popViewControllerAnimated:YES];
    
}

-(UITextView*)textView{
    if (!_textView) {
        _textView=[[UITextView alloc]initWithFrame:DHFlexibleFrame(CGRectMake(20, 120, 370, 150), NO)];
        _textView.backgroundColor=[UIColor clearColor];
        _textView.showsVerticalScrollIndicator=YES;
        _textView.font=[UIFont systemFontOfSize:14*DHFlexibleHorizontalMutiplier()];
        _textView.layer.borderWidth=1*DHFlexibleHorizontalMutiplier();
        _textView.layer.borderColor=[UIColor grayColor].CGColor;
        _textView.delegate=self;
    }
    
    return _textView;
}

-(UILabel *)titileLabel{
    if (!_titileLabel) {
        _titileLabel=[[UILabel alloc]initWithFrame:DHFlexibleFrame(CGRectMake(20, 90, 200, 30), NO)];
        _titileLabel.backgroundColor=[UIColor clearColor];
        _titileLabel.text=@"说点什么吧...";
        _titileLabel.font=[UIFont systemFontOfSize:18*DHFlexibleHorizontalMutiplier()];
    }
    return _titileLabel;
    
}

-(UIButton*)sendButton{

    if (!_sendButton) {
        _sendButton=[UIButton buttonWithType:UIButtonTypeCustom];
        _sendButton.frame=DHFlexibleFrame(CGRectMake(ORIGIN_WIDTH - 80, 20 + 12 * DHFlexibleVerticalMutiplier(), 60, 30), NO);
        [_sendButton setTitle:@"提交" forState:UIControlStateNormal];
    }

    return _sendButton;

}

-(UIButton *)addImage{
    if (!_addImage) {
        _addImage=[UIButton buttonWithType:UIButtonTypeCustom];
        _addImage.frame=DHFlexibleFrame(CGRectMake(20, 280, 60, 60), NO);
        [_addImage setImage:[UIImage imageNamed:@"添加图片.png"] forState:UIControlStateNormal];
        _addImage.layer.borderColor=[UIColor grayColor].CGColor;
        _addImage.layer.borderWidth=1;
        
    }

    return _addImage;

}
-(BOOL)textViewShouldBeginEditing:(UITextView *)textView{

    [self.view resignFirstResponder];
    return YES;
}

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    
    [self.view endEditing:YES];
    
}
@end
